<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="../static/azxcrm/css/bootstrap.css"
	th:href="@{/azxcrm/css/bootstrap.css}" />
<link href="../static/azxcrm/css/infoDetails.css"
	th:href="@{/azxcrm/css/infoDetails.css}" rel="stylesheet" />
<script th:inline="javascript"> var ctx = [[@{/}]]; </script>
</head>
<body>
	<div class="bigbox">
		<!-- 客户资料详情 -->
		<div class="edit">
			<div class="edit_box clearfix">
				<div class="customers_face">
					<img src="../../../img/faceLogo.png" alt="image" class="img-circle" />
				</div>
			</div>
			<div class="customers_detail clearfix">
				<p><span>客户详情</span></p>
				<div>
					<ul class="customers_information">
						<li th:text="'姓名：'+${customerInfo.name}"></li>
						<li th:text="'年龄：'+${customerInfo.age}"></li>
						<li th:text="'客户背景：'+${customerInfo.backgroundName}"></li>
					</ul>
				</div>
				<div>
					<ul class="customers_information2">
						<!-- 两种实现方法
						<li th:switch="${customerInfo.sex}">性别： 
						    <span th:case="'0'">未知</span>
							<span th:case="'1'">男</span> 
							<span th:case="'2'">女</span></li>
						 -->
						<li th:if="${customerInfo.sex} == 0">性别：未知</li>
						<li th:if="${customerInfo.sex} == 1">性别：男</li>
						<li th:if="${customerInfo.sex} == 2">性别：女</li>
						<li class="g-time" th:text="'创建时间：'+${customerInfo.createTime}"></li>
					</ul>
				</div>
				<!-- <div>
                <a href="" class="edit_information">编辑资料</a>
            </div> -->
			</div>
		</div>

		<!-- 客户资料详情 -->
		<div class="Tab_warp">
			<ul id="myTab" class="nav nav-tabs list-group-item">
				<li class="active "><a href="#home" data-toggle="tab"> 客户资料</a></li>
				<li><a href="#jmeter " data-toggle="tab">销售订单</a></li>
				<li><a href="#ejb " data-toggle="tab">操作记录</a></li>
				<li><a href="#integral " data-toggle="tab">积分明细</a></li>
			</ul>
			<div id="myTabContent" class="tab-content">
				<div class="tab-pane fade in active" id="home">
					<h4 class="pos-rel">基本信息</h4>
					<table class="table">
						<tbody>
							<tr class="table_phone">
								<td>手机号码</td>
								<td th:text="${customerInfo.cellphone}"></td>
								<td>电话号码</td>
								<td th:text="${customerInfo.phoneNum}"></td>
							</tr>
							<tr class="table_phone">
								<td>身份证号码</td>
								<td th:text="${customerInfo.identityNum}"></td>
								<td>出生日期</td>
								<td th:text="${customerInfo.birth}"></td>
							</tr>
							<tr class="table_phone">
								<td>职位</td>
								<td th:text="${customerInfo.job}"></td>
								<td>所在地</td>
								<td th:text="${customerInfo.province}+'-'+${customerInfo.city}+'-'+${customerInfo.area}+'-'+${customerInfo.addressDetail}"></td>
							</tr>
						</tbody>
					</table>
					<h4 class="pos-rel">参客记录</h4>
					<table class="table table-bordered table2">
						<thead>
							<tr class="table_name">
								<th>参课时间</th>
								<th>姓名</th>
								<th>手机号码</th>
								<th>部门</th>
								<th>业务员</th>
								<th>是否本人咨询</th>
							</tr>
						</thead>
						<tbody>
							<tr th:each="customerAttendance : ${customerAttendanceList}">
								<td th:text="${customerAttendance.attendanceTime}"></td>
								<td th:text="${customerAttendance.attendCustName}"></td>
								<td th:text="${customerAttendance.cellphoneNum}"></td>
								<td th:text="${customerAttendance.dept.deptName}"></td>
								<td th:text="${customerAttendance.createBy}"></td>
								<td th:text="${customerAttendance.isOwnself} == 0?本人 : 代咨询"></td>
							</tr>
						</tbody>
					</table>
				</div>
				<!-- 销售订单 -->

				<div class="tab-pane fade" id="jmeter">
					<h4 class="pos-rel">销售订单</h4>

					<table class="table table-bordered table3"
						th:each="orderDeal : ${orderDeals}">
						<tbody class="table3_tbody">
							<input type="hidden" id="orderId" name="orderId" th:value="${orderDeal.order.orderId}">
							<tr>
								<td>订单号：<span th:text="${orderDeal.order.orderNum}"></span></td>
								<td>订单类型：<span th:text="${orderDeal.order.typeName}"></span></td>
							</tr>
							<tr>
								<td>部门：<span th:text="${orderDeal.order.deptName}"></span></td>
								<td>业务员：<span th:text="${orderDeal.order.salesUserName}"></span></td>
							</tr>
							<tr class="table_76">
								<td>订单状态： <span th:if="${orderDeal.dealStatus} == 1">财务成单</span>
									<span class="spand" th:text="${orderDeal.dealStatus}"></span> <span
									th:if="${orderDeal.dealStatus} == 2">线索成单</span> <span
									th:if="${orderDeal.dealStatus} == 3">已退款</span>
								</td>
								<td>创建时间：<span th:text="${orderDeal.order.createTime}"></span></td>
							</tr>
							<tr>
								<td colspan='2'><button type="button" class="text-red">查看详情</button></td>
							</tr>
						</tbody>
					</table>
				</div>
				<!-- 销售订单 -->
				<div class="tab-pane fade" id="ejb">
					<h4 class="pos-rel">操作记录</h4>
					<table class="table table-condensed table4">
						<tbody class="table4_tbody">
							<tr class="table44_tr">
								<td>时间</td>
								<td>事件</td>
								<td>详细</td>
							</tr>
							<tr class="table4_tr" th:each="customerModifyRecord : ${customerModifyRecordList}">
								<td th:text="${customerModifyRecord.modifyTime}"></td>
								<td th:text="${username}+'编辑了客户资料'"></td>
								<td th:text="${customerModifyRecord.modifyDetail}"></td>
							</tr>
						</tbody>
					</table>
					<!-- 
					<nav aria-label="Page navigation" class="page">
						<ul class="pagination">
							<li><a href="#" aria-label="Previous"> <span
									aria-hidden="true">上一页</span>
							</a></li>
							<li><a href="#">1</a></li>
							<li><a href="#">2</a></li>
							<li><a href="#">3</a></li>
							<li><a href="#">4</a></li>
							<li><a href="#">...</a></li>
							<li><a href="#" aria-label="Next"> <span
									aria-hidden="true">下一页</span>
							</a></li>
						</ul>
					</nav>
					 -->
				</div>
				<!-- 积分明细 -->
				<div class="tab-pane fade" id="integral">
					<h4 class="pos-rel">积分明细</h4>
					<div class="table table-condensed table4">
						<ul class="table4_tbody">
							<li class="table44_tr"><span>时间</span> <span>类型</span> <span>变动积分</span>
								<span>变更后积分数量</span></li>
							<li class="table44_tr ulLi" th:each="customerIntegralRecord : ${customerIntegralRecordList}">
								<span th:text="${customerIntegralRecord.createTime}"></span> <span
								th:if="${customerIntegralRecord.integralType} == 0"
								class="integralType">系统充值</span> <span
								th:if="${customerIntegralRecord.integralType} == 1"
								class="integralType">系统扣除</span> <span
								th:if="${customerIntegralRecord.integralType} == 2"
								class="integralType">订单成交</span> <span
								th:if="${customerIntegralRecord.integralType} == 3"
								class="integralType">商品兑换</span> <span class="integral"
								th:text="${customerIntegralRecord.integralNumber}"></span> <span
								class="order-cx"><span
									th:text="${customerIntegralRecord.integralTotal}"></span> <!-- <a class="detalis">查看详情</a> --></span>

								<div class="detalis-xq">
									<div class="salerNub Number-1">
										<p class="orderNumber">
											<span class="azxNumber"><small>订单号：</small><small
												th:text="${customerIntegralRecord.orderId}"></small></span> <span
												class="azxNumber"><small>兑换商品：</small><small
												th:text="${customerIntegralRecord.productName}"></small></span>
										</p>
										<p class="orderNumber">
											<span class="azxNumber"><small>数量：</small><small
												th:text="${customerIntegralRecord.productNumber}"></small></span> <span
												class="azxNumber"><small>单价：</small><small
												th:text="${customerIntegralRecord.integralNumber}"></small></span>
										</p>
									</div>
									<div class="salerNub Number-2">
										<p class="orderNumber">
											<span class="azxNumber"><small>订单号：</small><small>AZX52552565255</small></span>
											<span class="azxNumber"><small>销售产品：</small><small>二期床位-颐福卡-舒适间</small></span>
										</p>
										<p class="orderNumber">
											<span class="azxNumber"><small>销售价格：</small><small>99526</small></span>
										</p>
									</div>
								</div>
							</li>
						</ul>
					</div>
				</div>
			</div>
		</div>

	</div>
	<div th:include="include::footer"></div>
	<!-- 操作处理 -->
	<script src="/js/jquery-ui-1.10.4.min.js"
		th:src="@{/js/jquery-ui-1.10.4.min.js}"></script>
	<script src="/ajax/libs//datapicker/bootstrap-datepicker.js"
		th:src="@{/ajax/libs//datapicker/bootstrap-datepicker.js}"></script>
</body>
</html>
<script>

$(function(){
	 var integralType = $(".integralType");
	 var integral = $(".integral");	    
	  
    for(var i=0;i<integralType.length;i++){
        if(integralType[i].innerHTML=="系统充值"){       	
            integral[i].innerHTML = "+" + integral[i].innerHTML;
        }else if(integralType[i].innerHTML=="系统扣除"){
            integral[i].innerHTML = "-"+integral[i].innerHTML;
        }else if(integralType[i].innerHTML=="订单成交"){  
        	integral[i].innerHTML = "+" + integral[i].innerHTML;
        	$(".integralType").eq(i).siblings(".detalis-xq").find(".Number-1").remove();        	
        	var Index = $(".order-cx").eq(i);
        	$("<a class='detalis'>查看详情</a>").appendTo(Index);
        }else if(integralType[i].innerHTML=="商品兑换"){   
        	 integral[i].innerHTML = "-"+integral[i].innerHTML;
        	$(".integralType").eq(i).siblings(".detalis-xq").find(".Number-2").remove()
        	var Index = $(".order-cx").eq(i);
            $("<a class='detalis'>查看详情</a>").appendTo(Index);
        } 	
    }
    $('.detalis').click(function(){    
        if($(this).text()=='查看详情'){
           $(this).text('点击收起');
           $(this).parents('span').siblings('.detalis-xq').css('display','block');
           $(this).parents('li').css('border-bottom','none')
        }else{
            $(this).text('查看详情');
            $(this).parents('span').siblings('.detalis-xq').css('display','none');
            $(this).parents('li').css('border-bottom','1px solid #f3f3f3')
        }
    }) 
})

var orderId = document.getElementById("orderId").value||null; 
$('.text-red').click(function(){
	var vaLue=$(this).parent().parent().parent().find('.spand').text()
	if(vaLue==1||vaLue==2){
		var prefix = ctx + "/module/order"
        var url = prefix + '/edit/' + orderId;
        layer_showAuto("成单详情", url);
	}else{
		var prefix = ctx + "module/orderDeal"
	    var url = prefix + '/edit/' + orderId;
	    layer_showAuto("退单详情", url);
	}
})

</script>